function fnLogin() {
        var user = document.getElementById('username');
        var pwd = document.getElementById('password');
        var tip = document.getElementById('tip');
        if(user.value.length==0 || pwd.value.length==0){
            tip.innerHTML = '请输入用户名和密码';
            tip.style.height='30px';
            tip.style.width='290px';
            tip.style.color='#fff';
            tip.style.backgroundColor='#cc3300';
            tip.style.lineHeight='30px';
            tip.style.textAlign='center';
        }
        else if(user.value=='tom' && pwd.value==123){
            window.location = 'https://mail.swpu.edu.cn/';
        }
        else{
            tip.innerHTML = '您填写的用户名或者密码错误';
            tip.style.height='30px';
            tip.style.width='290px';
            tip.style.color='#fff';
            tip.style.backgroundColor='#cc3300';
            tip.style.lineHeight='30px';
            tip.style.textAlign='center';
        }
      }
function getCookie(cname){
    var name = cname + "=";
    var ca = document.cookie.split(';');
    for(var i=0; i<ca.length; i++) {
        var c = ca[i].trim();
        if (c.indexOf(name)==0) { return c.substring(name.length,c.length); }
    }
    return "";
}
function checkCookie(){
    var user=getCookie("username");
    var uname=document.getElementById("username");
    var pwd=getCookie("pwd");
    var upwd=document.getElementById("password");

    if (user!=""){
        var uname=document.getElementById("username");
        uname.value=user;
        upwd=pwd;
    }
}
window.onload=function()//用window的onload事件，窗体加载完毕的时候
{

    checkCookie();
}